#!/usr/bin/env python3
# coding:utf-8
import timeit

name = "lilisi"
age = 18
profession = "student"

# 1.单行
message = f"Hi {name}, info:age={age}, profession={profession}"
print(message)

# 2.多行
message = f"Hi {name}, \
info:age={age}, \
profession={profession}"
print(message)

# 3.性能测试
t1 = timeit.timeit(
    """
name = "lilisi"
age = 18
profession = "student"
'Hi %s, info:age=%d, profession=%s'%(name,age,profession)
"""
)
print("string %:", t1)

t2 = timeit.timeit(
    """
name = "lilisi"
age = 18
profession = "student"
'Hi {}, info:age={}, profession={}'.format(name,age,profession)
"""
)
print("string fromat:", t2)

t3 = timeit.timeit(
    """
name = "lilisi"
age = 18
profession = "student"
f'Hi {name}, info:age={age}, profession={profession}'
"""
)
print("string fast:", t3)

# 性能测试结果
# string %: 0.11550007299229037
# string fromat: 0.14628155199170578
# string fast: 0.08965828199870884